﻿namespace Single.Core.Service
{
    public abstract class ServiceDependency
    {
        /// <summary>
        /// 反馈
        /// </summary>
        /// <param name="success"></param>
        /// <param name="message"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        public ServiceResult BaseResult(bool success, string message = null, object data = null)
        {
            return new ServiceResult(success, message, data);
        }

        /// <summary>
        /// 成功反馈
        /// </summary>
        /// <param name="message"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        public ServiceResult SuccessResult(string message = "操作成功", object data = null)
        {
            return BaseResult(true, message, data);
        }

        /// <summary>
        /// 失败反馈
        /// </summary>
        /// <param name="message"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        public ServiceResult FailureResult(string message = "操作失败", object data = null)
        {
            return BaseResult(false, message, data);
        }

        /// <summary>
        /// 未知反馈
        /// </summary>
        /// <param name="success"></param>
        /// <param name="successMessage"></param>
        /// <param name="failureMessage"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        public ServiceResult UnknownResult(bool success, string successMessage = "操作成功", string failureMessage = "操作失败", object data = null)
        {
            return BaseResult(success, success ? successMessage : failureMessage, data);
        }
    }
}
